<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>订单列表</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}" href="../../css/bootstrap.min.css"/>
    <link rel="stylesheet" th:href="@{/css/mystyle.css}" href="../../static/css/mystyle.css" />
</head>
<body>
<div class="container background">
    <div style="height: 50px"></div>
    <div th:replace="fragments :: navbar"></div>
    <div class="container">
        <ul class="nav nav-pills">
            <th:block th:each="user : ${users}">
                <li role="presentation" th:class="${user.isActive() == true?'active':''}">
                    <a th:text="${user.userName}"
                       th:href="@{/monitor/user/active(userName=${user.userName})}">主题一</a>
                </li>
            </th:block>
            <li class="pull-right"><a href="/monitor/list" class="btn btn-default">刷新</a></li>
            <li class="pull-right"><a href="/monitor/user/list" class="btn btn-default">用户列表</a></li>
        </ul>
        <div class="pull-right">

            <!--<a href="form.html" th:href="@{/(form)}">Create Message</a>-->
        </div>
        <table class="table table-bordered table-striped">
            <thead>
            <tr>
                <th>工单流水号</th>
                <th>工单主题</th>
                <th>派单时间</th>
                <th>完成时限</th>
                <th>处理环节</th>
                <th>任务状态</th>
                <th>任务所有者</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:if="${orders.empty}">
                <td colspan="8">没有订单</td>
            </tr>
            <tr th:each="order : ${orders}">
                <td><a th:text="${order.orderNum}">1</a></td>
                <td th:text="${#strings.substring(order.orderTheme,0,10)}" th:title="${order.orderTheme}">主题一</td>
                <td th:text="${order.dispatchTime}">派单时间</td>
                <td th:text="${order.handlerLimitTime}">完成时限</td>
                <td th:text="${order.handleLink}">处理环节</td>
                <td th:text="${order.orderStatus}">任务状态</td>
                <td th:text="${order.orderOwner}">任务所有者</td>
                <td th:if="${order.orderStatus == '已接单'}"></td>
                <!--th:if="${order.orderStatus == '未接单'}"-->
                <td ><a opera="jiedan" th:attr="detailUrl=${order.detailUrl},orderNum=${order.orderNum}">接单</a></td>
            </tr>
            </tbody>
        </table>
        <div id="showDetail"></div>
    </div>
</div>
<script type="text/javascript" th:src="@{/js/jquery-1.7.2.js}"
        src="../../static/js/jquery-1.7.2.js"></script>
<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"
        src="../../static/plugin/layer/layer.js"></script>
<script type="text/javascript">
    $(function () {
        $("a[opera=jiedan]").click(function () {
            var orderNum = $(this).attr("orderNum");
            var detailUrl = $(this).attr("detailUrl");
            $.ajax({
                url:"/monitor/detail",
                type:"get",
                data:{param:detailUrl},
                success:function (result) {
                    $("#showDetail").html(result);
                },
                error:function (result) {

                }
            })
        });
    })

    setInterval(function(){
        location.reload();
        }, 600000);
</script>
</body>
</html>